//
//  AddViewController.m
//  17-homework-addressBook
//
//  Created by 王道林 on 16/8/6.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "AddViewController.h"

@interface AddViewController ()
@property (weak, nonatomic) IBOutlet UITextField *TextfieldName;
@property (weak, nonatomic) IBOutlet UITextField *TextFieldPhone;
@property (weak, nonatomic) IBOutlet UITextField *TextfieldPhone;
@property (weak, nonatomic) IBOutlet UITextField *TextFieldAge;
@property (weak, nonatomic) IBOutlet UITextField *TextFieldHome;
@property (nonatomic, strong) Contecter *contecter;
@end

@implementation AddViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)AddContecter:(id)sender {
    
    _contecter = [[Contecter alloc] initWithName:_TextfieldName.text PicName:@"2" phoneNumber:_TextFieldPhone.text homePlace:_TextFieldHome.text];
    _contecter.age = _TextFieldAge.text;
    _contecter.gender = _TextfieldPhone.text;
    
    [self.delegate passValue:_contecter];
    [self.navigationController popViewControllerAnimated:YES];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
